Skip to content

[webview_flutter_lwe] Fix "channel sent a message from native to Flutter on a non-platform thread" error#790

Merged
JSUYA merged 4 commits intoflutter-tizen:masterfrom
seungsoo47:dev.webveiw.250106.2
Jan 7, 2025
Merged

[webview_flutter_lwe] Fix "channel sent a message from native to Flutter on a non-platform thread" error#790
JSUYA merged 4 commits intoflutter-tizen:masterfrom
seungsoo47:dev.webveiw.250106.2

Conversation

@seungsoo47
Copy link
Contributor

When following code is run:

navigation_delegate_channel_->InvokeMethod(
       "onPageStarted", std::make_unique<flutter::EncodableValue>(args));

this message happens

[ERROR:flutter/shell/common/shell.cc(1065)] The 'plugins.flutter.io/lwe_webview_navigation_delegate_0' channel 
sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the 
platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application 
code creating that channel.
See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.

So, in order to resolve this problem, I added a function to dispatch tasks on the main thread.

@seungsoo47 seungsoo47 marked this pull request as draft January 6, 2025 07:38
@seungsoo47 seungsoo47 marked this pull request as ready for review January 6, 2025 09:13
Copy link
Member

@JSUYA JSUYA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JSUYA JSUYA merged commit 9398e21 into flutter-tizen:master Jan 7, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants